import { createEntities } from "./createEntities";
import { createModel } from "./createModel";
import { createRouter } from "./createRoute";
import { createService } from "./createServices";

// const params = {
//   name: "CodeGeneration",
//   fields: ["moduleName", "fields", "superDir", "relationFile"],
//   superDir: "codeGeneration",
// };
export async function generCode(params: any) {
  // 生成实体类
  createEntities(params);

  // 生成模型
  createModel({
    tableName: params.tableName,
    entitesName: params.name,
    fields: params.fields,
    superDir: params.superDir,
  });

  // 生成servic
  createService({ superDir: params.superDir, moduleName: params.name });

  // 生成router
  createRouter({ superDir: params.superDir, moduleName: params.name, fields: params.fields });
}
